import { defineStore } from "pinia";
import { createCommonActions } from "../commonActions";
import _axios from "~/common/axios";

export const useBasedataStore = defineStore("basedata", {
  state: () => ({}),
  actions: {
    ...createCommonActions("basedata"),
    importData(payload: any) {
      return new Promise((resolve, reject) => {
        let formData = new FormData();
        formData.append("file", payload);
        _axios
          .POST({
            url: "/basedata/import/data",
            data: formData,
          })
          .then((res) => {
            resolve(res);
          })
          .catch((e) => {
            reject(e);
          });
      });
    },
  },
  getters: {},
});
